<%@ page language="java" contentType="text/html; charset=UTF-8"%>

<!DOCTYPE html>
<html>
	<head>
		<title>我的购物车</title>
		<%@include file="/common/header.jsp" %>
		<link rel="stylesheet" href="${basePath }css/myorder.css" />
				
	</head>
	<body>
		<%@include file="/common/top.jsp" %>
		
		<div class="container">
		<s:if test="orderList != null">
		<form action="#" method="post">
		   <div class="_cart">
		     <div class="_cart_title">
		        <h2>我的订单</h2>
		     </div>
		   <!-- Modal end-->	
		     <div class="_cart_table">
		      
			       <table class="table table-responsive">
			          <tr class="warning">
			            <td width="45%">商品信息</td>
			            <td width="10%">总金额</td>
			            <td width="10%">订单状态</td>
			            <td width="5%">操作</td>
			          </tr>
			          
			          <s:iterator value="orderList" status="st">
				          <tr>
				          	<td colspan="4">  </td>
				          </tr>
			      		  <tr>
			      	    	<td colspan="4" style="line-height: 10px;height: 10px;background-color: #EFEAE5;">订单号：<s:property value="id"/> &nbsp;&nbsp;&nbsp;&nbsp;下单时间:<s:date name="time" format="yyyy-MM-dd hh:mm"/></td>
			      		  </tr>
				          <tr>
				            <td style="vertical-align: middle;">
				            	<s:iterator value="orderItems">
					            	<img src="${basePath }img/goods/<s:property value="good.img"/>" class="img-thumbnail" width="80" height="80" border="1">
				            	</s:iterator>
				            </td>
				            <td style="vertical-align: middle;"><s:property value="sumPrice"/></td>
				            <td style="vertical-align: middle;"><s:property value="status"/></td>
				            <td style="vertical-align: middle;">
				            	<s:if test="status == '未支付' ">
				            		<button data-toggle="modal" data-target="#myModal" class="btn btn-mini btn-danger" type="button" onclick="doPay('<s:property value="id" />')">支付</button>
				            	</s:if>
				            	<s:else>
					          	  <button data-toggle="modal" data-target="#myModal" class="btn btn-mini btn-danger" type="button" onclick="doDetail('<s:property value="id" />')">查看</button>
				            	</s:else>
				            </td> 
				          </tr>
			          </s:iterator>
			          
			       </table>
		     
		     </div>
		   </div>
		   

	   	  </form>
	   	  </s:if>
		  <s:else>
		  	<div style="height:500px;text-align:center;">
	   	 	 	<h1>您的订单为空</h1>
	   	  	</div>
	   	  </s:else>
	   	</div> <!-- /container -->
	   	
		<%@include file="/common/footer.jsp" %>
		
		<script>
			function doDetail(id){
				window.location = "${basePath}order_toDetailUI.action?order.id="+id;
			}
			function doPay(id){
				window.location = "${basePath}order_pay.action?order.id="+id;
			}
		</script>
	</body>
</html>
